import request, { $request } from '@/utils/request';
// import { formatParams } from '@/utils'
import api from '@/api'

/**
 * 获取属性信息
 */
export const getOne = async (params) => {
    return request(api.dictionary_attr, {
        params,
    });
}

/**
 * 字典节点查询
 */
export const search = async (params) => {
    return $request(api.dictionary_search, {
      params,
    })
};

/**
 * 获取节点信息
 */
export const getNode = async (params) => {
    return request(api.dictionary_node, {
        params,
    });
}

/**
 * 删除节点
 */
export const deleteNode = async (data) => {
    return request.post(api.dictionary_node_remove, {
        data,
    });
}

/**
 * 节点树
 */
export const getNodes = async (params) => {
    return request(api.dictionary_nodes, {
        params,
    });
}

/**
 * 删除扩展属性
 */
export const deleteRows = async (data) => {
    return request.post(api.dictionary_attr_remove, {
        data,
    });
}

/**
 * 扩展属性列表
 */
// export const getList = async (data) => {
//     const params = formatParams(data);
//     return request.post(api.dictionary_attrs, {
//         params,
//     });
// }

export const getList = async (params) => {
    return request(api.dictionary_attrs, {
        params,
    });
}